package com.legal.utils;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class UserContext {
    private static final ThreadLocal<String> userNoTL = new ThreadLocal<>();
    private static final ThreadLocal<String> chatIdTL = new ThreadLocal<>();

    public static void setContext(String userNo, String chatId) {
        userNoTL.set(userNo);
        chatIdTL.set(chatId);
    }

    public static String getUserNo() {
        return userNoTL.get();
    }

    public static String getChatId() {
        return chatIdTL.get();
    }

    public static void clear() {
        userNoTL.remove();
        chatIdTL.remove();
    }
}